//
//  ViewController.m
//  ov reminder
//
//  Created by Boyd Rotgans on 19-02-12.
//  Copyright (c) 2012 __MyCompanyName__. All rights reserved.
//

#import "ViewController.h"

@implementation ViewController
@synthesize knop;

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Release any cached data, images, etc that aren't in use.
}

#pragma mark - View lifecycle

- (void)viewDidLoad
{
    [super viewDidLoad];
	// Do any additional setup after loading the view, typically from a nib.
    
    // knop
    //knop = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, 320, 100)];
    //[knop setBackgroundColor:[UIColor blueColor]];
    //[knop setTitle:@"press me!" forState:UIControlStateNormal];
    //[knop addTarget:self action:@selector(knopingedrukt) forControlEvents:UIControlEventTouchUpInside];
    //[self.view addSubview:knop];
    
    // toggle
    UISwitch *togle = [[UISwitch alloc] initWithFrame:CGRectMake(135, 150, 50, 50)];
    [togle addTarget:self action:@selector(switchToggled:) forControlEvents:UIControlEventValueChanged];
    [self.view addSubview:togle];
    
}

- (void) switchToggled:(id)sender {
    
    UISwitch *mySwitch = (UISwitch *)sender;
    if ([mySwitch isOn]) {
        NSLog(@"its on!");
    } else {
        NSLog(@"its off!");
    }
}

- (void)viewDidUnload
{
    [super viewDidUnload];
    // Release any retained subviews of the main view.
    // e.g. self.myOutlet = nil;
}

- (void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:animated];
}

- (void)viewDidAppear:(BOOL)animated
{
    [super viewDidAppear:animated];
}

- (void)viewWillDisappear:(BOOL)animated
{
	[super viewWillDisappear:animated];
}

- (void)viewDidDisappear:(BOOL)animated
{
	[super viewDidDisappear:animated];
}

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    // Return YES for supported orientations
    return (interfaceOrientation != UIInterfaceOrientationPortraitUpsideDown);
}

@end
